Skip to main content

All Questions

Tagged with
1vote
2answers
1kviews

Find All Permutations of String in Scala

I created the following function, permutations, to produce all permutations of a List[A]. Example: ...
Kevin Meredith's user avatar
1vote
1answer
64views

Find the combination of matches which are closest to each other

Problem - Given three sorted arrays find combinations which are closest to each other. example - ...
vikrant's user avatar
3votes
1answer
2kviews

All combinations of 2-value variables

Introduction This code was part of one of my projects where it was used to generate boolean input values for truth tables. I have since generalized it for combinations of variables with only 2 values, ...
Tamoghna Chowdhury's user avatar
8votes
1answer
237views

Scala implementation of @rolfl's integer-partitioning algorithm

While reviewing @Martijn's Distinct sums of integers (finding all combinations of positive integers that sum to a given number), I proposed the following solution: ...
200_success's user avatar
5votes
1answer
432views

Safe cracker string with all combinations

Imagine a safe with a 4-digit code, and accepting a continuous stream of code entries, such that when the 4 digits are seen in the right sequence, the safe opens. Generate a short string that contains ...
janos's user avatar
  • 112k
1vote
1answer
179views

Combinations with replacement

I am still new to Scala and wrote a small snippet to find all the combinations with replacement of a sequence (e.g. cwr(ab, 3) should give aaa, aab, abb, bbb). The slow way would be to generate all ...
Thomas Nelson's user avatar

close